﻿using System;
using System.Collections.Generic;
using MTUnity.Utils;
using Script.UI.Component;
using UnityEngine;

namespace Script.UI
{
    public enum VisitorAttr
    {
        Visitor,
        Worker,
        Car,
    }

    public class OverviewWndData
    {
        public VisitorPanelData visitorPanelData;
        public VoltagePanelData voltagePanelData;
        public PressurePanelData pressurePanelData;
    }

    public class VisitorPanelData
    {
        public class VisitorData : IPillarGroupObjectDataProvider
        {
            public long time;
            public int visitNum;
            public int maxVisitNum;
            public float GetSliderValue()
            {
                return visitNum / (float) maxVisitNum;
            }

            public string GetDownText()
            {
                var tdata = TimeUtil.FromTimestamp(time);
                return $"{tdata.Day}/{tdata.Month}";
            }

            public string GetUpText()
            {
                return visitNum.ToString();
            }
        }

        public List<VisitorData> datas;
        public string choseGroup;
        public long dataTime;
    }

    public class VoltagePanelData
    {
        public class VoltageData : IPillarGroupObjectDataProvider
        {
            public long time;
            public int  voltage;
            public int maxVoltage;
            public float GetSliderValue()
            {
                return voltage / (float) maxVoltage;
            }

            public string GetDownText()
            {
                var tdata = TimeUtil.FromTimestamp(time);
                return tdata.Hour.ToString();
            }

            public string GetUpText()
            {
                return voltage.ToString();
            }
        }

        public List<VoltageData> datas;
        public string choseGroup;
        public long dataTime;
        public int nowVoltage;
    }
    
    
    public class PressurePanelData
    {
        public class PressureData : IPillarGroupObjectDataProvider
        {
            public long time;
            public int pressure;
            public int maxShowPressure; 
            public float GetSliderValue()
            {
                return pressure / (float)maxShowPressure;
            }

            public string GetDownText()
            {
                return TimeUtil.FromTimestamp(time).Hour.ToString();
            }

            public string GetUpText()
            {
                return pressure.ToString();
            }
        }

        public List<PressureData> datas;
        public string choseGroup;
        public long dataTime;
        public int nowPressure;

    }
}